import {lazy} from "react";
import {Navigate} from "react-router-dom";

const aRoutes = [
    {
        path: "/a",
        element: ()=><Navigate to="/a/a1"/>
    },
    {
        path: "/a/a1",
        name: "a-a1",
        element: lazy(() => import(/*webpackChunkName:"dd"*/"../views/routes-list/A/child/A1")),
    },
    {
        path: "/a/a2",
        name: "a-a2",
        element: lazy(() => import("../views/routes-list/A/child/A2")),
    },
    {
        path: "/a/a3",
        name: "a-a3",
        element: lazy(() => import("../views/routes-list/A/child/A3")),
    }
]

export  const routes = [
    {
        path: "/",
        children: [],
        element: ()=><Navigate to={'/a'}/>//遇到Navigate会直接跳转，这样写的话调用时候再跳转
    },
    {
        path: "/a",
        name: "A",
        meta:{},
        element: lazy(()=>import('../views/routes-list/A/AFather')),//<A/> 就是在调用A组件
        children: aRoutes
    },
    {
        path: "/b",
        name: "B",
        meta:{},
        children: [],
        element: lazy(() => import(/*webPackChunkName:"B"*/"../views/routes-list/B/BFather")),
    },
    {
        path: '/c/:id?/:name?',
        name: "C",
        meta:{},
        children: [],
        element: lazy(() => import('../views/routes-list/C/CFather'),)
    }
]